import tkinter as tk


def on_click(event):
    print("Canvas区域被点击了！")


root = tk.Tk()
root.title("Canvas点击事件")

canvas = tk.Canvas(root, height=50, width=200, bg="SystemButtonFace", highlightthickness=0)
canvas.pack()
canvas.create_text(100, 25, text="这是一个Label", font=("Arial", 12))  # 在Canvas上绘制文本
canvas.tag_bind("all", "<Button-1>", on_click)  # 绑定点击事件到Canvas上的所有元素

root.mainloop()